﻿<Window x:Class="WetHatLab.OneNote.TaggingKit.manage.TagManager"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cui="clr-namespace:WetHatLab.OneNote.TaggingKit.common.ui"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:local="clr-namespace:WetHatLab.OneNote.TaggingKit.manage"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:prop="clr-namespace:WetHatLab.OneNote.TaggingKit.Properties"
        Title="{Binding Mode=OneTime,
                        Source={x:Static prop:Resources.TagManager_Window_Title}}"
        Width="{Binding Source={x:Static prop:Settings.Default},
                        Path=TagManagerWindow_Width,
                        Mode=TwoWay}"
        Height="{Binding Source={x:Static prop:Settings.Default},
                         Path=TagManagerWindow_Height,
                         Mode=TwoWay}"
        MinWidth="350"
        MinHeight="250"
        Closing="Window_Closing"
        Icon="/OneNoteTaggingKit;component/Resources/tagSettings128x128.png"
        WindowStartupLocation="CenterOwner"
        WindowStyle="ToolWindow"
        d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True,
                                         Type={x:Type local:TagManagerDesignerModel}}"
        mc:Ignorable="d">
    <Window.Resources>
        <ResourceDictionary Source="pack://application:,,,/OneNoteTaggingKit;component/Resources/Styles.xaml" />
    </Window.Resources>

    <Window.Background>
        <LinearGradientBrush MappingMode="RelativeToBoundingBox" StartPoint="0.5,0" EndPoint="0.5,1">
            <GradientStop Offset="0.497" Color="Ivory" />
            <GradientStop Offset="1" Color="#FFF3DEF2" />
        </LinearGradientBrush>
    </Window.Background>
    <TabControl Grid.Row="0" Background="Transparent">
        <TabItem BorderThickness="0"
                 IsSelected="True"
                 Header="{Binding Mode=OneTime,
                                  Source={x:Static prop:Resources.TagManager_PreferencesTab_Header}}"
                 ToolTip="{Binding Mode=OneTime,
                                   Source={x:Static prop:Resources.TagManager_PreferencesTab_Tooltip}}">
            <StackPanel Orientation="Vertical">
                <GroupBox Header="{Binding Mode=OneTime,
                                  Source={x:Static prop:Resources.TagManager_PreferencesTab_DialogPreferencesGroup_Header}}">
                    <StackPanel Orientation="Vertical">
                        <CheckBox Content="{Binding Mode=OneTime,
                                       Source={x:Static prop:Resources.TagManager_PreferencesTab_DialogPreferences_TagEditorOnTop}}"
                              ToolTip="{Binding Mode=OneTime,
                                       Source={x:Static prop:Resources.TagManager_PreferencesTab_DialogPreferences_TagEditorOnTopTooltip}}"
                              IsChecked="{Binding Source={x:Static prop:Settings.Default},Path=TagEditorAlwaysOnTop,Mode=TwoWay}" />
                        <CheckBox Content="{Binding Mode=OneTime,
                                       Source={x:Static prop:Resources.TagManager_PreferencesTab_DialogPreferences_TagSearchOnTop}}"
                              ToolTip="{Binding Mode=OneTime,
                                       Source={x:Static prop:Resources.TagManager_PreferencesTab_DialogPreferences_TagSearchOnTopTooltip}}"
                              IsChecked="{Binding Source={x:Static prop:Settings.Default},Path=TagSearchAlwaysOnTop,Mode=TwoWay}" />
                    </StackPanel>
                </GroupBox>
                <GroupBox Header="{Binding Mode=OneTime,
                                  Source={x:Static prop:Resources.TagManager_PreferencesTab_OSGroup_Header}}">
                    <StackPanel Orientation="Vertical">
                        <CheckBox Content="{Binding Mode=OneTime,
                                       Source={x:Static prop:Resources.TagManager_PreferencesTab_OS_UseWindowsSearch}}"
                              ToolTip="{Binding Mode=OneTime,
                                       Source={x:Static prop:Resources.TagManager_PreferencesTab_DialogPreferences_UseWindowsSearch_Tooltip}}"
                              IsChecked="{Binding Source={x:Static prop:Settings.Default},Path=UseWindowsSearch,Mode=TwoWay}" />
                    </StackPanel>
                </GroupBox>
            </StackPanel>
        </TabItem>
        <TabItem BorderThickness="0"
                 Selector.Selected="TabItem_Selected"
                 Header="{Binding Mode=OneTime,
                                  Source={x:Static prop:Resources.TagManager_TagSuggestionsTab_Header}}"
                 ToolTip="{Binding Mode=OneTime,
                                   Source={x:Static prop:Resources.TagManager_TagSuggestionsTab_Tooltip}}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <cui:TagInputBox x:Name="tagInput"
                                 Grid.Row="0"
                                 Grid.Column="0"
                                 Margin="5,5,5,5"
                                 VerticalAlignment="Center"
                                 TagInput="TagInputBox_Input"
                                 ToolTip="{Binding Mode=OneTime,
                                                   Source={x:Static prop:Resources.TagManager_NewTagTextbox_Tooltip}}" />
                <Button x:Name="newTagButton"
                        Grid.Row="0"
                        Grid.Column="2"
                        Width="26"
                        Height="26"
                        HorizontalAlignment="Center"
                        Click="NewTagButton_Click"
                        Margin="0,0,5,0"
                        Background="GreenYellow"
                        Style="{StaticResource controlEffectStyle}"
                        ToolTip="{Binding Mode=OneTime,
                                            Source={x:Static prop:Resources.TagManager_NewTagButton_Tooltip}}">
                    <TextBlock  VerticalAlignment="Center"
                                FontFamily="Segoe UI Symbol"
                                FontSize="22"
                                FontWeight="ExtraBold"
                                Text="✙"
                                TextAlignment="Center" />
                </Button>
                <cui:HighlightedTagsPanel x:Name="suggestedTags"
                                          Grid.Row="1"
                                          Grid.Column="0"
                                          Grid.ColumnSpan="2"
                                          Header="{Binding Mode=OneTime,
                                                           Source={x:Static prop:Resources.TagManager_SuggestedTags_Header}}"
                                          TagSource="{Binding SuggestedTags}">
                    <cui:HighlightedTagsPanel.TagTemplate>
                        <DataTemplate>
                            <local:RemovableTag Margin="0,5,5,0" Action="Tag_Action" />
                        </DataTemplate>
                    </cui:HighlightedTagsPanel.TagTemplate>
                </cui:HighlightedTagsPanel>
                <Menu Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
                      BorderThickness="0"
                      Margin="0,0,8,0"
                      Background="Transparent"
                      ToolTip="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_Menu_Tooltip}}"
                      VerticalAlignment="Top"
                      HorizontalAlignment="Right">
                    <MenuItem BorderThickness="0" Background="Transparent">
                        <MenuItem.Resources>
                            <Style TargetType="{x:Type MenuItem}">
                                <Setter Property="FontSize" Value="16" />
                                <Setter Property="BorderThickness" Value="1" />
                                <Setter Property="BorderBrush" Value="LightBlue" />
                                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.MenuColorKey}}" />
                            </Style>
                        </MenuItem.Resources>
                        <MenuItem.Header>
                            <TextBlock Text=""
                                       FontWeight="Heavy"
                                       FontFamily="Segoe UI Symbol"
                                       FontSize="20"
                                       VerticalAlignment="Top"
                                       Margin="0,-3,0,0" />
                        </MenuItem.Header>
                        <MenuItem Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.FoundPages_MenuItem_Refresh}}"
                          Tag="Refresh"
                          Click="MenuItem_Click">
                            <MenuItem.Icon>
                                <TextBlock  Text=""
                                    FontFamily="Segoe UI Symbol"
                                    FontWeight="ExtraBold"
                                    FontSize="14"
                                    VerticalAlignment="Center"
                                    HorizontalAlignment="Center" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Click="MenuItem_Click"
                                  Tag="Copy"
                                  Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_ContextMenu_Copy}}">
                            <MenuItem.Icon>
                                <Image Source="/OneNoteTaggingKit;component/Resources/copy-26.png" />
                            </MenuItem.Icon>
                        </MenuItem>
                    </MenuItem>
                </Menu>
                <ProgressBar Name="pBar"
                             Grid.Row="1"
                             Grid.Column="0"
                             Grid.ColumnSpan="2"
                             Visibility="Visible" />
            </Grid>
        </TabItem>
        <TabItem Header="{Binding Mode=OneTime, Source={x:Static prop:Resources.TagManager_AboutTab_Header}}">
            <RichTextBox Margin="5,5,5,0"
                         Background="Transparent"
                         BorderThickness="0"
                         IsDocumentEnabled="True"
                         IsReadOnly="True">
                <FlowDocument>
                    <Paragraph>
                        <Image Height="32"
                               HorizontalAlignment="Left"
                               VerticalAlignment="Top"
                               Source="/OneNoteTaggingKit;component/Resources/tag 32x32.png" />
                        <Run BaselineAlignment="Center"
                             FontSize="16"
                             FontWeight="Bold"
                             Foreground="LightSeaGreen"
                             Text="{Binding Mode=OneTime,
                                            Source={x:Static prop:Resources.TaggingKit_About_Appname}}" />
                        <Run BaselineAlignment="Center" Text="{Binding AddinVersion, Mode=OneTime}" />
                    </Paragraph>
                    <Paragraph>
                        <Run FontWeight="Bold" Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Description}}" />
                        <LineBreak />
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Copyright}}" />
                    </Paragraph>
                    <Paragraph>
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Framework}}" />
                        <Run BaselineAlignment="Center" Text="{Binding FrameworkVersion, Mode=OneTime}" />
                    </Paragraph>
                    <Paragraph>
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Configuration}}" />
                        <Run Text=":" />
                        <Run Text="{Binding Configuration, Mode=OneTime}" />
                    </Paragraph>
                    <Paragraph>
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Website}}" />
                        <Run Text=":" />
                        <Hyperlink NavigateUri="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_AddIn_Website}}" RequestNavigate="Hyperlink_RequestNavigate">
                            <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_AddIn_Website}}" />
                        </Hyperlink>
                    </Paragraph>
                    <Paragraph>
                        <Run Text="{Binding Mode=OneTime, Source={x:Static prop:Resources.TaggingKit_About_Logfile}}" />
                        <Run Text=":" />
                        <Hyperlink NavigateUri="{Binding Logfile}" RequestNavigate="Hyperlink_RequestLogNavigate">
                            <Run Text="{Binding Logfile, Mode=OneTime}" />
                        </Hyperlink>
                    </Paragraph>
                </FlowDocument>
            </RichTextBox>
        </TabItem>
    </TabControl>
</Window>